import { createContext } from "react";

// 用户信息类型定义
export interface UserInfo {
  id: string;
  username: string;
  avatar: string;
  email: string;
}

// 认证上下文类型定义
interface AuthContextType {
  isAuthenticated: boolean;
  userInfo: UserInfo | null;
  setIsAuthenticated: (value: boolean) => void;
  setUserInfo: (info: UserInfo | null) => void;
  logout: () => void;
}

// 创建认证上下文
export const AuthContext = createContext<AuthContextType>({
  isAuthenticated: false,
  userInfo: null,
  setIsAuthenticated: () => {},
  setUserInfo: () => {},
  logout: () => {},
});